# $InformationPreference
# SilentlyContinue

# 示例1：为Get-results写入信息
# -InformationAction Continue 就是等于 $InformationPreference = Continue
# Write-Information -MessageData "Processes starting with 'P'" -InformationAction Continue
# # 获取名字开头p的线程
# Get-Process -Name p*

# 示例2：写入信息并进行标记
# $message = "To filter your results for PowerShell, pipe your results to the Where-Object cmdlet."
# Get-Process -Name p*
# Write-Information -MessageData $message -Tags "Instructions" -InformationAction Continue

# 示例3：将信息写入文件
# function Test-Info{
#     Get-Process p*
#     Write-Information "Here you go"
# }
# Test-Info 6> C:\Users\31840\powershell-workspace\Write\Info.txt

# 示例4：传递对象以写入信息
Get-Process | Sort-Object CPU -Descending |
    Select-Object Id, ProcessName, CPU -First 10 |
        Write-Information -InformationAction Continue